#GLOBAL
varying vec4 Position_VSPS;
varying vec2 Texcoord_VSPS;

uniform float simulateSize;
uniform vec2 sampleOffsets[8];
uniform sampler2D MyTexture;
#END

#VS
attribute vec3 Position0;
attribute vec2 Texcoord0;

void main()
{
	gl_Position = Position_VSPS = vec4(Position0, 1);




	Texcoord_VSPS = Texcoord0;

}
#END

#PS
void main()
{
	vec4 color = texture2D(MyTexture, Texcoord_VSPS);
	color = (color-0.5) * 2.0;

	float force = -color.z;
	for (int i = 0; i != 8; ++i)
	{
		vec4 block = texture2D(MyTexture, Texcoord_VSPS + (sampleOffsets[i] * simulateSize));
		block = (block-0.5) * 2.0;

		force += (block.z - color.z);
	}
	color.x += force * 0.11111111111111111111111111111111;
	color.x *= .99;
	color.z += color.x;

	gl_FragData[0] = (color+1.0) * 0.5;
}
#END

